#ifndef COIN_H
#define COIN_H
#include <iostream>
#include <vector>
#include <climits>
using namespace std;
int mincoin( vector<int>&numlimit,int amount){
    vector<int>a(amount+1,INT_MAX);
    vector<int>coin={1,5,10,25};
    a[0]=0;
    vector<vector<int>>nl(amount+1,numlimit);
    for (int i=1;i<=amount;i++){
        for(int j=0;j<4;j++){
            if(coin[j]<=i&&nl[i-coin[j]][j]>0){
            int temp=a[i-coin[j]];
            if(temp!=INT_MAX&&temp+1<a[i]){
                a[i]=temp+1;
                for(int k=0;k<4;k++){
                    nl[i][k]=nl[i-coin[j]][k];
                    if(k==j)nl[i][k]--;
                    
                }
            
            }
            }
        }
    }
    return a[amount];
}
#endif